import { Component, OnInit } from '@angular/core';
import {ParamService} from '../../service/param.service';
import { Observable } from 'rxjs/Rx';

@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css'],
  providers: [ParamService]

})
export class HomeComponent implements OnInit {

msg:any;

  constructor(private service: ParamService) { }

  ngOnInit() {
    let timer = Observable.timer('some time', 2000);
            timer.subscribe(t => this.test());
  }

  test(): void {
    this.service.getTest()
      .subscribe(params => {
        this.msg=params;
        console.log(params);
      });
  }

}
